﻿@model Physis.Client.Models.Sponsor.SponsorTypeModel

@{ Layout = "~/Views/Configuration/ConfigurationItemMaster.cshtml"; }

<script type="text/javascript" src="~/Scripts/Application/Sponsor/SponsorType.js"></script>

@section ItemPropertyTabsContent_GeneralProperties {

    
    <div style="padding: 4px 4px 0px 8px;">
                 
        <div>

            @* BELOW IS THE ALWAYS AVAILABLE DIRECT, THIS IS NOT MUTUALLY EXCLUSIVE *@

            <div style="margin-bottom: 4px;"><span style="cursor: pointer;"><input id="AllowedParent_0" name="AllowedParent" type="checkbox" value="0" @((Model.SponsorType.AllowedParent (0)) ? "checked=\"checked\"" : String.Empty) /><label for="AllowedParent_0" style="font-weight: bold;">(direct to program relationship)</label></span></div>

            @foreach (Physis.Core.Sponsor.SponsorType currentSponsorType in Model.Application.Core.Sponsor.SponsorTypes(false).OrderBy(each => each.Name)) {
             
                if (currentSponsorType.Id != Model.SponsorType.Id) { // NOT THE SAME SPONSOR TYPE AS THE REQUESTING, WE ALREADY HAVE DIRECT 
                    
                    if ((currentSponsorType.Enabled) || (Model.SponsorType.AllowedParent (currentSponsorType.Id))) { // EITHER IT IS AVAILABLE (ENABLED) OR CURRENTLY IN USE BY THE SPONSOR TYPE 
                    
                        <div style="margin-bottom: 4px;"><span style="cursor: pointer;">
                        
                            <input id="AllowedParent_@currentSponsorType.Id" name="AllowedParent" type="checkbox" value="@currentSponsorType.Id"  @((Model.SponsorType.AllowedParent (currentSponsorType.Id)) ? "checked=\"checked\"" : String.Empty) />
                        
                            <label for="AllowedParent_@currentSponsorType.Id">@currentSponsorType.Name</label>

                        </span></div>
                
                    }
                       
                }
                   
            }

        </div>

    </div>


}

@section ItemPropertyTabs {
    
}

@section ItemPropertyTabsContent {

    
}


<script type="text/javascript">

    @* UI TWEAKS USING JAVASCRIPT TO RE-PURPOSE THE PROPERTIES SECTION *@ 

    @* THIS WILL NEED TO CHANGE IN THE FUTURE IF TYPES GET PROPERTIES  *@ 

    @* TRYING TO PREVENT THE CREATION OF ANOTHER TAB FOR RELATIONSHIPS *@ 

    $("#ItemPropertyTabsContent_GeneralProperties").css("overflow", "auto");

    $("#PropertyTab_General").children()[1].innerHTML = "Allowed Parent Sponsor Types";

</script>